<?php

namespace Models;

class UserPost extends \Phalcon\Mvc\Model
{

    /**
     *
     * @var integer
     */
    public $id;
     
    /**
     *
     * @var integer
     */
    public $idUser;
     
    /**
     *
     * @var integer
     */
    public $idPost;
     
    /**
     * Independent Column Mapping.
     */
    public function columnMap()
    {
        return array(
            'id' => 'id', 
            'idUser' => 'idUser', 
            'idPost' => 'idPost'
        );
    }

    public function getSource()
    {
        return 'user_post';
    }

    public function initialize()
    {
        $this->belongsTo('idPost', 'Models\Post', 'id', array(
            'alias' => 'post'
        ));
        $this->belongsTo('idUser', 'Models\User', 'id', array(
            'alias' => 'user'
        ));
    }

}
